#include<iostream>
using namespace std;
const int N = 1e6 + 10;
int arr[N];
int n, m;
int find(int q)
{
	int l = 1;
	int r = n;
	while (l < r) {
		int mid = (l + r) >> 1;
		if (arr[mid] >= q) {
			r = mid;
		}
		else {
			l = mid + 1;
		}
	}
	if (arr[l] == q) {
		return l;
	}
	return -1;
}
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		cin >> arr[i];
	}
	while (m--) {
		int q;
		scanf_s("%d", &q);
		cout << find(q) << " ";
	}
	return 0;
}